#include "Automat.h"
#include "State.h"
#include "Scanner.h"

AutomatOO::AutomatOO(IScanner* scanner) {
	currentState = StateStart::makeState();
	this->scanner = scanner;
}

AutomatOO::~AutomatOO() {
	// currentstate is singleton - no need to do cleanup
}

inline TokenType AutomatOO::handle(char c) {
	return currentState->operation(c, this);
}

void AutomatOO::ungetChar(size_t count) {
	scanner->ungetChar(count);
}

void AutomatOO::setCurrentState(State* state) {
	// currentstate is singleton - no need to do cleanup
	currentState = state;
}

void AutomatOO::error() {
}
